define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'ordertask/index' + location.search,
                    add_url: 'ordertask/add',
                    edit_url: 'ordertask/edit',
                    del_url: 'ordertask/del',
                    multi_url: 'ordertask/multi',
                    import_url: 'ordertask/import',
                    table: 'ordertask',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                fixedColumns: true,
                fixedRightNumber: 1,
                columns: [
                    [
                        {checkbox: true},
                        // {field: 'id', title: __('Id')},
                        {field: 'status', title: __('状态'), searchList: {"0":__('未接单'),"1":__('已接单'),"2":__('已取消')}, formatter: Table.api.formatter.status},
                           
                        {field: 'order_sn', title: __('匹配单号'), operate: 'LIKE'},
                        // {field: 'uid', title: __('Uid'), operate: 'LIKE'},
                        // {field: 'mobile', title: __('Mobile'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        {field: 'money', title: __('Money'), operate:false},
                        // {field: 'puid', title: __('Puid'), operate: 'LIKE'},
                        // {field: 'pmobile', title: __('Pmobile'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        {field: 'tran_font_num', title: __('总字数'), operate:false},
                        {field: 'tran_font_word', title: __('Tran_font_word'), operate:false},
                        // {field: 'tarn_price', title: __('Tarn_price'), operate:'BETWEEN'},
                        {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        {field: 'sex', title: __('Sex'), searchList: {"0":__('不限'),"1":__('男'),"2":__('女')}, formatter: Table.api.formatter.status},
                        
                        
                        {field: 'level', title: __('Level'),searchList: {"0":__('不限'),"1":__('1-10'),"2":__('11-20'),"3":__('21-30'),"4":__('31-40'),"5":__('41-50')}, formatter: Table.api.formatter.status},
                        
                        {field: 'is_bao', title: __('作品保密'), searchList: {"0":__('不需保密'),"1":__('需保密')}, formatter: Table.api.formatter.status},
                        
                        
                        // {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        {field: 'apply_time', title: __('Apply_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        
                        // {field: 'jd_time', title: __('接单时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        
                        // {field: 'qx_time', title: __('Qx_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
      
                        
                      
                           
                        // {field: 'c_title', title: __('C_title'), operate: false},
                        {field: 'c_desc', title: __('C_desc'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        {field: 'c_content', title: __('C_content'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        // {field: 'c_word_count', title: __('C_word_count'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        // {field: 'min_level', title: __('Min_level'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        // {field: 'max_level', title: __('Max_level'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        // {field: 'coupon_money', title: __('Coupon_money'), operate:false},
                        // {field: 'cv_id', title: __('Cv_id'), operate: 'LIKE'},
                        {field: 'apply_num', title: __('下单数量')},
                        // {field: 'amount', title: __('Amount'), operate:false},
                        // {field: 'sid', title: __('Sid'), operate: 'LIKE'},
                        {field: 's_end_time', title: __('S_end_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        // {field: 'type', title: __('Type')},
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});
